<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>Active Entry Form by Mike McGrath</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<SCRIPT type=text/javascript>
<!-- Original:  Mike McGrath   (mike_mcgrath@lineone.net) -->
<!-- Web Site:  http://website.lineone.net/~mike_mcgrath/ -->
<!--

function count(f,n,u)
{
  f.line_sum[n].value = f.line[n].value * u;
  f.line_sum[n].value = Math.ceil(f.line_sum[n].value * 1000) /1000;
  f.line_sum[n].value = Math.floor(f.line_sum[n].value * 1000) /1000;
  f.line_sum[n].value = Math.round(f.line_sum[n].value * 100)/100;
  if(f.line_sum[n].value == "NaN")
  {
    alert("Error:\nYou may only enter numbers...\nPlease retry");
    f.line[n].value = f.line[n].value.substring(0, f.line[n].value.length-1);
    f.line_sum[n].value = f.line[n].value * u;
    if(f.line_sum[n].value == "0") f.line_sum[n].value = "";
  }
  else 
  {
    var gt = 0;
    for(i=0; i < f.line_sum.length; i++)
    {
      gt += Math.ceil(f.line_sum[i].value * 1000) /1000;
    }
    gt = Math.round(gt * 1000)/1000;
    f.grand_total.value = "$ " + gt;
    decimal(f);
   }
}

function get_data(f)
{
  var order_data = "This Order is ...\n";
  for(i=0; i < f.line.length; i++)
  {
    if(f.line[i].value == "") f.line[i].value = "0";
    order_data += "Line " +i+ " = "+f.line[i].value +" Qty\n";
  }
  if(f.grand_total.value == "") f.grand_total.value = "Nil";
  order_data += "Total Order Value = " + f.grand_total.value;
  document.g.order.value = order_data; 
}

function decimal(f)
{
  for(i=0; i<f.line_sum.length; i++)
  {
    var d = f.line_sum[i].value.indexOf(".");
    if(d == -1 && f.line[i].value != 0) f.line_sum[i].value += ".00";
    if(d == (f.line_sum[i].value.length-2)) f.line_sum[i].value += "0";
    if(f.line_sum[i].value == "00") f.line_sum[i].value="";
  }
  d = f.grand_total.value.indexOf(".");
  if(d == -1) f.grand_total.value += ".00";
  if(d == (f.grand_total.value.length-2)) f.grand_total.value += "0";
}

function send_data(g)
{
  get_data(document.f);
  if(document.f.grand_total.value == "Nil")
  {
    var conf = confirm("No items are entered - \nDo you want to submit a blank order?");
    if(conf)g.submit(); else init();
  }
  else g.submit();
}

function init()
{
  document.f.reset();
  document.f.line[0].select();
  document.f.line[0].focus();
  document.g.order.value="";
}

window.onload=init;

// -->
</SCRIPT>

</HEAD>
<BODY bgColor=black>
<CENTER>
<FORM name="f" action="">
<TABLE cellSpacing=0 cellPadding=5 width=320 bgColor=limegreen border=0 
SUMMARY="">
  <TBODY>
  <TR>
    <TD align=middle colSpan=4><B>Order Form</B></TD></TR>
  <TR bgColor=beige>
    <TD><U>Item</U></TD>
    <TD><U>Qty</U></TD>
    <TD><U>Each</U></TD>
    <TD align=right><U>Total</U></TD></TR>
  <TR>
    <TD>Line 0</TD>
    <TD><INPUT onkeyup=count(this.form,0,5.95) size=5 name=line> </TD>
    <TD>$ 5.95</TD>
    <TD align=right><INPUT readOnly size=10 name=line_sum></TD></TR>
  <TR bgColor=beige>
    <TD>Line 1</TD>
    <TD><INPUT onkeyup=count(this.form,1,10.95) size=5 name=line> </TD>
    <TD>$ 10.95</TD>
    <TD align=right><INPUT readOnly size=10 name=line_sum></TD></TR>
  <TR>
    <TD>Line 2</TD>
    <TD><INPUT onkeyup=count(this.form,2,20.95) size=5 name=line> </TD>
    <TD>$ 20.95</TD>
    <TD align=right><INPUT readOnly size=10 name=line_sum></TD></TR>
  <TR bgColor=beige>
    <TD><INPUT onclick=init() type=button value=Reset></TD>
    <TD align=right colSpan=2><U>Grand Total :</U></TD>
    <TD align=right><INPUT readOnly size=10 name=grand_total></TD></TR>
  <TR>
    <TD align=middle colSpan=4><INPUT onclick=get_data(this.form) type=button value="Press to Verify Order"> 
    </TD></TR></TBODY></TABLE></FORM>
<FORM name=g action="javascript:alert('This form would now be submitted')" method=post encType=text/plain>
<TABLE cellSpacing=0 cellPadding=5 width=320 bgColor=limegreen border=0 
SUMMARY="">
  <TBODY>
  <TR>
    <TD align=middle><textarea name=order rows=5 cols=35></textarea>
    <P><INPUT onclick=send_data(this.form) type=button value="Press to Submit Order"> 
      </P></TD></TR></TBODY></TABLE>
</FORM></CENTER></BODY></HTML>
